package com.czxy.demo15;

import java.util.ArrayList;

public class Test01 {

    public static void main(String[] args) {
        String str = "<Dog name='小白' color='白色'  sons='小黑,小花'/>";
        String s = str.replace("<Dog name='", "").replace("' color='", " ").replace("'  sons='", " ").replace("'/>", "");
        String[] s1 = s.split(" ");
        String[] split = s1[2].split(",");
        ArrayList<String> list=new ArrayList<>();
        for (String s2 : split) {
            list.add(s2);
        }
        Dog d=new Dog(s1[0],s1[1],list);
        System.out.println(d);
    }

}
